package com.example.ioc;

import com.example.ioc.controller.HelloController;
import com.example.ioc.controller.UserController;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

//@ComponentScan(basePackages = "com.example.ioc")
@SpringBootApplication
public class Java20240323IoCApplication {

    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(Java20240323IoCApplication.class, args);

//        UserController usercon = (UserController) context.getBean("usercon");
//        usercon.sayHi();
//        UserController bean = context.getBean(UserController.class);
//        bean.sayHi();
//        HelloController bean = context.getBean(HelloController.class);
//        bean.sayHi();
//        System.out.println(bean);
//
//        HelloController helloController = (HelloController) context.getBean("helloController");
//        helloController.sayHi();
//        System.out.println(helloController);
//
//        HelloController bean1 = context.getBean("helloController", HelloController.class);
//        bean1.sayHi();
//        System.out.println(bean1);

//        UController bean = context.getBean(UController.class);
//        bean.sayHi();
//
//        UController uController = (UController) context.getBean("UController");
//        uController.sayHi();
//
//        UController bean1 = context.getBean("UController", UController.class);
//        bean1.sayHi();
//
//        System.out.println(Introspector.decapitalize("UController"));
//        System.out.println(Introspector.decapitalize("HelloController"));

//        UserService bean = context.getBean(UserService.class);
//        bean.doService();
//
//        UserComponent bean1 = context.getBean(UserComponent.class);
//        bean1.doComponent();
//
//        UserConfig bean2 = context.getBean(UserConfig.class);
//        bean2.doConfig();
//
//        UserRepo bean3 = context.getBean(UserRepo.class);
//        bean3.doRepo();

//        UserInfo bean = (UserInfo) context.getBean("UCInfo");
//        System.out.println(bean);
    }

}
